--- ME WANT COOKIE ---

Written by Sander Alsema for the 10-liner competition 2020.
Language: Commodore 64 Basic v2
Category: PUR-80


I prefer VICE, but you can use any emulator that works with *.d64 files.
If you haven't installed it yet, it can be downloaded from their website.

Here's how to use it:
 Click : File -> Attach disk image -> Drive 8
 Select: Me Want Cookie.d64
 Click : Attach

Now, just as you would with a normal Commodore 64, you can type:
 LOAD"$",8                (to load the directory)
 LOAD"ME WANT COOKIE",8   (to load the game)
 LIST                     (to view the directory or game listing)
 RUN                      (to run the game)

Be aware that you are now using a virtual Commodore 64 keyboard.
Therefore the keys will differ slightly from your physical keyboard:
use <SHIFT> '2' to display quotation marks.
 
---

It's a well documented fact that cookies fly through the air at night.
Cookiemonster is well aware of this and has purchased a butterfly net to
satisfy his needs.

In this game you can help him sustain his cookie addiction.

By pressing 'Q' you stretch his arm.
By pressing 'A' you retract his arm.

If you miss 1 cookie, the game is over.
If you catch 20 cookies, however, you win!

Everytime you catch a cookie, Cookiemonster moves 1 position to the right,
making it harder to catch the next one.
The cookie's flightpath becomes more erratic as the game progresses, which
adds to the difficulty.

THIS GAME IS A WORK OF FAN FICTION. NO COPYRIGHT INFRINGEMENT INTENDED.

---

Line 0: Set background colour to black.

        Read string data for victory text, Cookiemonster's body and
        butterfly net string.

        Build a string that doubles as a vertical position string and an
        environment string. Also build an arm string.


Line 1: Complete the butterfly net string.

        Make a string that displays "COOKIES:".

        Make a string that displays the environment and "COOKIES:".

        Set Cookiemonster's positioning variable to the far left.

        Set Cookiemonster's arm length variable.

        Complete the victory text.


Line 2: Display the environment and Cookiemonster's body.

        Set the cookie horizontal positioning variable to the far right.

        Randomly set the cookie vertical positioning variable.

        If 20 cookies have been caught, then use the victory text and jump
        to line 8.


Line 3: Display Cookiemonster's arm and butterfly net.

        Calculate the position of the cookie.

        Set the colour of the cookie to brown.

        Read the keyboard.


Line 4: Display the cookie.

        If the key pressed was 'Q', then increase the arm length variable.

        If the key pressed was 'A', then decrease the arm length variable.


Line 5: As the game progresses, make it more probable for the cookie to
        alter its course. Here is how the formula works:

           first an alternated course is randomly picked (1 up, 1 down,
           or straight).
           Whether this course change is actually used or not, is decided
           by multiplying it by either 0 or 1. This number is randomly
           generated using the positioning variable of Cookiemonster.


Line 6: Erase the old cookie.

        If the cookie was next to a butterfly net character, then move
        Cookiemonster 1 position to the right and jump to line 2.


Line 7: Move the cookie 1 position to the left.

        If the cookie is still on screen, then jump to line 3.

        This line also contains string data for the victory text.


Line 8: Clear the screen, display the amount of cookies and "GAME OVER".
        If the game was won, then display the victory text.

        Wait for the player to press any key.

        Restart the game.


Line 9: This line contains string data for Cookiemonster's body and his
        butterfly net.

---